package com.jamal2362.apktool.util;

import com.jamal2362.apktool.R;

public class IconTypes {
	public static final int colorFolderLight = 0xFF444444;
	public static final int colorFolderDark = 0xFF000000;
	public static final int colorFile = 0xFF607D8B;
	public static final int colorText = 0xFF3860AF;
	public static final int colorImage = 0xFF39A1A2;
	public static final int colorVideo = 0xFFFB8C00;
	public static final int colorAudio = 0xFFE53935;
	public static final int colorHtml = 0xFF2083BD;
	public static final int colorApk = 0xFF2083BD;
	public static final int colorArchive = 0xFF795548;
	public static final int colorApks = 0xFF40AD3E;

	public static int[] getType(String s) {
		if (s.endsWith(".apk"))
			return new int[]{R.drawable.ic_apk, colorApk};
			
		if (s.endsWith(".apkm"))
			return new int[]{R.drawable.ic_apk, colorFile};

		if (s.endsWith(".apks") || s.endsWith(".xapk"))
			return new int[]{R.drawable.ic_apk, colorArchive};

		String[] video = new String[]{"3gp", "asf", "avi", "mp4", "mpe", "mpeg", "mpg", "mpg4", "m4u", "m4v", "mov", "rmvb"};
		for (String t : video) {
			if (s.endsWith("." + t))
				return new int[]{R.drawable.ic_video, colorVideo};
		}

		String[] text = new String[]{"txt", "xml", "conf", "prop", "cpp", "h", "java", "log", "json", "js", "php", "css", "py", "c", "smali", "cfg", "ini", "bat", "mf", "mtd", "lua"};
		for (String t : text) {
			if (s.endsWith("." + t))
				return new int[]{R.drawable.ic_text, colorText};
		}

		String[] html = new String[]{"htm", "html"};
		for (String t : html) {
			if (s.endsWith("." + t))
				return new int[]{R.drawable.ic_html, colorHtml};
		}

		String[] image = new String[]{"jpeg", "jpg", "bmp", "gif", "png", "webp"};
		for (String t : image) {
			if (s.endsWith("." + t))
				return new int[]{R.drawable.ic_image, colorImage};
		}

		String[] audio = new String[]{"m3u", "m4a", "m4b", "m4p", "mp2", "mp3", "mpga", "ogg", "wav", "wma", "wmv", "3gpp", "flac", "amr"};
		for (String t : audio) {
			if (s.endsWith("." + t))
				return new int[]{R.drawable.ic_audio, colorAudio};
		}

		String[] archive = new String[]{"zip", "rar", "7z", "tar", "jar"};
		for (String t : archive) {
			if (s.endsWith("." + t))
				return new int[]{R.drawable.ic_archive, colorArchive};
		}

		return new int[]{R.drawable.ic_file, colorFile};
	}
}
